package com.herui.iot.data;


import com.herui.sport_care.data.check.source.CheckRepository;
import com.herui.sport_care.data.check.source.CheckSource;
import com.herui.sport_care.data.eval.source.EvalRepository;
import com.herui.sport_care.data.eval.source.EvalSource;
import com.herui.sport_care.data.report.source.ReportRepository;
import com.herui.sport_care.data.report.source.ReportSource;
import com.herui.sport_care.data.user.source.UserRepository;
import com.herui.sport_care.data.user.source.UserSource;

/**
 * Created by amanda.shan on 2021/9/30.
 */
public class RepositoryFactory {

    private static RepositoryFactory instance;

    private RepositoryFactory() {
        initUser();
        initEval();
        initCheck();
        initReport();
    }

    public void clearAll() {
    }
    public static RepositoryFactory getInstance() {

        if (instance == null) {
            synchronized (RepositoryFactory.class) {
                if (instance == null) {
                    instance = new RepositoryFactory();
                }
            }
        }
        return instance;
    }


    // user
    private UserSource userSource;
    private void initUser() {
        userSource = UserRepository.getInstance();
    }
    public UserSource getUserSource() {
        return userSource;
    }

    // eval
    private EvalSource evalSource;
    private void initEval() {
        evalSource = EvalRepository.getInstance();
    }
    public EvalSource getEvalSource() {
        return evalSource;
    }

    // check
    private CheckSource checkSource;
    private void initCheck() {
        checkSource = CheckRepository.getInstance();
    }
    public CheckSource getCheckSource() {
        return checkSource;
    }

    // report
    private ReportSource reportSource;
    private void initReport() {
        reportSource = ReportRepository.getInstance();
    }
    public ReportSource getReportSource() {
        return reportSource;
    }

}
